/**
 * This class is for the current position of an individual sprite.
 * You only need to specify an x and y coordinate.
 * This is based on the Cartesian coordinate system. The values
 * for X and Y can never exceed the values on the screen, or
 * go below 0 inclusive.
 * 
 */
package com.rpg.battle;

import android.util.DisplayMetrics;

/**
 * @author christ66
 *
 */
public class Position {
	/*
	 * Default constructor sets the current position to (0,0)
	 * 
	 */
	public Position() {
		this.x = 0;
		this.y = 0;
	}
	
	public Position(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	/**
	 * @return the x
	 */
	public int getX() {
		return x;
	}
	
	/**
	 * @return the y
	 */
	public int getY() {
		return y;
	}

	/**
	 * If X is larger than screen size, or less than 0 (inclusive) then don't move sprite.
	 * 
	 * @param x Change position in the X direction.
	 */
	public void setX(int x) {
		
		if (x >= 0 && x <= MAX_X)
			this.x = x;
	}

	/**
	 * If Y is larger than screen size, or less than 0 (inclusive) then don't move sprite.
	 * 
	 * @param y Change position in the Y direction.
	 */
	public void setY(int y) {
		
		if (y >= 0 && y <= MAX_Y)
			this.y = y;
	}
	
	private int x;
	private int y;
	
	/*
	 * @static MAX_X The max x dimension in pixels
	 * @static MAX_Y The max y dimension in pixels
	 */
	private final int MAX_X = new DisplayMetrics().widthPixels;
	private final int MAX_Y = new DisplayMetrics().heightPixels;
}
